package com.kefu.call.controller;

import com.kefu.call.model.CallSetUp;
import com.kefu.call.service.CallSetUpService;
import com.kefu.call.vo.CallSetUpUpdateVo;
import com.kefu.common.controller.AbstractBaseController;
import com.kefu.common.result.Result;
import com.kefu.common.result.ResultGenerator;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "通话设置")
@RestController
@RequestMapping("call/callSetUp/")
public class CallSetUpController extends AbstractBaseController {
    @Resource
    private CallSetUpService callSetUpService;

    @PostMapping("info")
    @ApiOperation(value = "通话设置", notes = "通话设置")
    public Result<CallSetUp> info(){
        return ResultGenerator.genSuccessResult(callSetUpService.info());
    }

    @PostMapping("update")
    @ApiOperation(value = "更新", notes = "更新")
    public Result<CallSetUp> update(@Validated @RequestBody CallSetUpUpdateVo updateVo){
        CallSetUp callSetUp = callSetUpService.updateCallSetUp(updateVo);
        return ResultGenerator.genSuccessResult(callSetUp);
    }
}
